"""
导入用户信息
"""
import os
import pandas as pd

"""
解析excel文件
"""


def get_excels_data(file_name: str) -> list:
    results = []
    try:
        df = pd.read_excel('files/inputs/' + file_name, header=None)
    except Exception as e:
        print(e)
        return []

    tem = df.values
    for item in tem:
        if len(item) != 2 or pd.isna(item[0]) or pd.isna(item[1]):
            continue
        results.append(item)
    return results


"""
获取某路径下全部的excel文件名
"""


def get_excels_name(file_dir) -> list:
    excels = []
    for root, dirs, files in os.walk(file_dir):
        for file in files:
            if os.path.splitext(file)[1] == '.xlsx' or os.path.splitext(file)[1] == '.xls':
                excels.append(os.path.join(root, file))
    return excels


if __name__ == '__main__':
    res = get_excels_data()
    print(res)
